package com.yyg.usecase.log;


import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.stream.IntStream;

/**
 * @Author: 冰岩
 * @Date: 2024/03/27
 * @Description:
 */
public class LogbackTest {
    Logger logger = LoggerFactory.getLogger(LogbackTest.class);
    @Test
    public void logInfoTest() {
        System.out.println(System.getProperty("user.home"));
        try {
            throw new RuntimeException("testEx");
        } catch (Exception e) {
            logger.error("logInfoTest", e);
        }
        logger.info("logInfoTest");
    }

    @Test
    public void logSizeRollingTest() {
        IntStream.range(0, 10_000).forEach(
            i -> {
                logger.info("logRollingTest " + i);
                try {
                    Thread.sleep(1);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        );
    }
}
